<?php
/* 
    � Alfa CMS Version 1.0.0.1 �
    � Habbo Content Management System - Alfa CMS create by JG �
    � This CMS is for private use, distribution or marketing prohibited. �
    � Jg Projects - Jg Webmaster [http://jgwebmaster.com.ar] �
    � Images and styles from Habbo hotel Sulake, All rights reserved. �
*/

require_once '../Environment.php';

RequireLogin();

$_SESSION['quickregister']['step_timesmap'] = time();

// Quickregister step1 submit - 

CleanVars();

// defined vars
$data = [
    $_POST['bean_day'],
    $_POST['bean_month'],
    $_POST['bean_year'],
    $_POST['bean_gender']
];

unset($_SESSION['quickregister']['error']);
unset($_SESSION['quickregister']['step1']);

$_SESSION['quickregister']['step1']['bean_day'] = $data[0];
$_SESSION['quickregister']['step1']['bean_month'] = $data[1];
$_SESSION['quickregister']['step1']['bean_year'] = $data[2];
$_SESSION['quickregister']['step1']['bean_gender'] = $data[3];

$errors = [
  '01' => '%step1_error%'  
];

$error = FALSE;

if(!checkdate($data[1], $data[0], $data[2]))
{
    $error = TRUE;
}
else if($data[2] > 2001)
{
    Location('quickregister/age_limit');
}

if($error)
{
    $_SESSION['quickregister']['error'] = $errors['01'];
    Location('quickregister/age_gate/e/05x');
}
else
{
    $_SESSION['quickregister']['step1']['complete'] = true;
    Location('quickregister/email_password');
}
?>